@{
    ViewBag.Title = "密码安全性在线检测";
    ViewBag.keywords = "密码强度检测,密码安全性检测";
    ViewBag.description = "想知道你的密码安全吗?想检测一下自己的密码容易被黑客破解吗？赽快来使用本工具吧，它会告诉你你的密码缺少哪些字符、被破解的几率有多大等";
var host = Appsettings.app("BaseFile:HostUrl");}
@section Styles{
<style>#result{color:#fff;padding:0 10px;background-color:#a8c89b;border-radius:5px;margin-bottom:5px;}.warning{color:#fff;background-color:#8693b9;border-radius:5px;padding:10px;margin:5px 0;}.advice{color:#fff;background-color:#ab86b9;border-radius:5px;padding:10px;}</style>
}
<div class="layui-row layui-form layui-form-pane">
    <div class="layui-form">
        <div class="layui-elem-quote">
            <label for="password">在下面输入你想要检测的密码，瞬间即会得到答案:)</label>
        </div>
        <div class="layui-form-item layui-form-text">
            <label class="layui-form-label">输入密码：</label>
            <div class="layui-input-block">
                <input type="password" class="layui-input" id="password" maxlength="60" placeholder="请输入密码" onkeyup="passcheck(this);" oninput="passcheck(this);">
            </div>
        </div>
        <div class="layui-form-item layui-form-text">
            <div class="layui-elem-quote">
                <p id="result"></p>
                <ul id="warnings"></ul>
            </div>
        </div>
        <div class="layui-form-item layui-form-text">
            <div><a></a></div>
        </div>
    </div>
</div>
@section Scripts{
<script src="@host/lib/hsimp.js"></script>
<script>
    passcheck = function (obj) {
        var cps = HSIMP.convertToNumber('250000000'), password = obj.value, time, i, checks; warnings.innerHTML = '';
        if (password) {
            time = HSIMP.time(password, cps.numeric);
            time = HSIMP.timeInPeriods(time);
            if (time.period === 'seconds') {
                if (time.time < 0.000001) {
                    result.innerHTML = '你的密码会被黑客攻破<br /><span>立刻补救！</span>';
                } else if (time.time < 1) {
                    result.innerHTML = '一台普通PC破解你的密码需要<br /><span>' + time.time + ' ' + time.period + '</span>';
                } else {
                    result.innerHTML = '一台普通PC破解你的密码需要<br /><span>约 ' + time.time + ' ' + time.period + '</span>';
                }
            } else {
                result.innerHTML = '一台普通PC破解你的密码需要<br /><span>约 ' + time.time + ' ' + time.period + '</span>';
            }
            checks = HSIMP.check(password);
            HSIMP.formatChecks(checks.results, warnings);
            if (checks.insecure) {
                result.innerHTML = '';
            }
        } else {
            result.innerHTML = '';
        }
    };
</script>
}